import { createRouter, createWebHistory } from 'vue-router'
import index from '../views/webPage/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'film',
      redirect: '/film/onPlaying',
      component: index,
      children:[
        {
          path: '/film/:type',
          name: 'films',
          component: () => import('@/views/film/FilmView.vue')
        },
        {
          path: '/cinema',
          name: 'cinema',
          component: () => import('@/views/cinema/CinemaView.vue'),
        },
        {
          path: '/mine',
          name: 'mine',
          component: () => import('@/views/mine/MineView.vue'),
        },
      ]
    },
    {
      path: '/filmdetails/:filmId',
      name: 'filmdetails',
      component: () => import('@/views/webPage/filmdetails/filmdetails.vue'),
    },
    {
      path: '/photos/:filmId',
      name: 'photos',
      component: () => import('@/views/webPage/photos/photos.vue'),
    },
    {
      path: '/cinema/:cinemaId',
      name: 'cinema_detail',
      component: () => import('@/views/webPage/cinema/cinema.vue'),
    }
  ],
})

export default router
